<?php

/**
 * Preinscripto form base class.
 *
 * @method Preinscripto getObject() Returns the current form's model object
 *
 * @package    sistema_itec_new
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasePreinscriptoForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                       => new sfWidgetFormInputHidden(),
      'apellido'                 => new sfWidgetFormInputText(),
      'nombre'                   => new sfWidgetFormInputText(),
      'telefono'                 => new sfWidgetFormInputText(),
      'celular'                  => new sfWidgetFormInputText(),
      'email'                    => new sfWidgetFormInputText(),
      'documento'                => new sfWidgetFormInputText(),
      'localidad_id'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Localidad'), 'add_empty' => false)),
      'unidad_formacion_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('UnidadFormacion'), 'add_empty' => false)),
      'accion_comunicacional_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AccionComunicacional'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'id'                       => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'apellido'                 => new sfValidatorString(array('max_length' => 100)),
      'nombre'                   => new sfValidatorString(array('max_length' => 100)),
      'telefono'                 => new sfValidatorString(array('max_length' => 15, 'required' => false)),
      'celular'                  => new sfValidatorString(array('max_length' => 15, 'required' => false)),
      'email'                    => new sfValidatorString(array('max_length' => 100)),
      'documento'                => new sfValidatorString(array('max_length' => 15)),
      'localidad_id'             => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Localidad'))),
      'unidad_formacion_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('UnidadFormacion'))),
      'accion_comunicacional_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AccionComunicacional'))),
    ));

    $this->widgetSchema->setNameFormat('preinscripto[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Preinscripto';
  }

}
